/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package packageModel;

import java.util.*;

/**
 *
 * @author pimas007
 */
public class Commande {
    
    private Integer numCom;
    private Integer numCli;
    private Calendar dateCom;
    private HashMap<Long, ItemPanier> lignesCom;
   
    public Commande(Integer numCli, Integer numCom, Calendar dateCom){
        
        this.numCli = numCli;
        this.numCom = numCom;
        this.dateCom = dateCom;
        this.lignesCom = new HashMap<Long, ItemPanier>();
        
    }
   
    public void addLigne(Long isbn, String titre, String auteurNom, Double unitPrice, Integer qte){
        
        getLignesCom().put(isbn, new ItemPanier(isbn, titre, auteurNom, unitPrice, qte));
            
    }
    
    
    
    
    
     public Double getTotal()
    {       
        double total = 0.00;
        
        for(ItemPanier item : lignesCom.values())
        {
            total += item.getQte() * item.getUnitPrice();
        } 
        return total;
    }  
    


    public Integer getNumCom() {
        return numCom;
    }


    public void setNumCom(Integer numCom) {
        this.numCom = numCom;
    }

    public Integer getNumCli() {
        return numCli;
    }

 
    public void setNumCli(Integer numCli) {
        this.numCli = numCli;
    }


    public Calendar getDateCom() {
        return dateCom;
    }

  
    public void setDateCom(Calendar dateCom) {
        this.dateCom = dateCom;
    }

 
    public HashMap<Long, ItemPanier> getLignesCom() {
        return lignesCom;
    }
}
